package com.eurake.seckill.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eurake.seckill.Exception.GlobalException;
import com.eurake.seckill.mapper.SeckillGoodsMapper;
import com.eurake.seckill.pojo.SeckillGoods;
import com.eurake.seckill.pojo.User;
import com.eurake.seckill.service.ISeckillGoodsService;
import com.eurake.seckill.vo.GoodsVo;
import com.eurake.seckill.vo.RespBeanEnum;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chen
 * @since 2024-11-24
 */
@Service
public class SeckillGoodsServiceImpl extends ServiceImpl<SeckillGoodsMapper, SeckillGoods> implements ISeckillGoodsService {
    @Resource
    private SeckillGoodsMapper seckillGoodsMapper;

    @Override
    public GoodsVo findGoodsVoByGoodsId(long goodsId) {
        GoodsVo goodsVo = seckillGoodsMapper.findGoodsVoByGoodsId(goodsId);
        if(goodsVo == null){
            throw new GlobalException(RespBeanEnum.Goods_NOT_FIND);
        }
        return goodsVo;
    }
}
